<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.yc.comm.Constant"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String strBtsName = request.getParameter("strBtsName");
String strChoosedTableId = request.getParameter("choosedTableId");
String choosedBtsName = request.getParameter("choosedBtsName");
String registBeginTime = request.getParameter("registBeginTime");
String registEndTime = request.getParameter("registEndTime");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base href="<%=basePath%>">
    <link rel="stylesheet" type="text/css" href="<%=path%>/js/ext/resources/css/ext-all.css">  
	<link rel="stylesheet" type="text/css" href="<%=path%>/js/ext/resources/css/edit-grid.css">   
	<script type="text/javascript" src="<%=path%>/js/ext/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="<%=path%>/js/ext/ext-all.js"></script>
	<script type="text/javascript" src="<%=path%>/js/ext/DWRTreeLoader.js"></script>
	<script type="text/javascript" src="<%=path%>/js/ext/SearchField.js"></script> 
	<script type="text/javascript" src="<%=path%>/js/ext/query-dwr-proxy.js"></script>	
	<script type='text/javascript' src="<%=path%>/dwr/engine.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/util.js"></script> 
	<script type='text/javascript' src="<%=path%>/dwr/interface/JCommWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JGeographicalenvWeb.js"></script>
    <title>地理环境</title>  

  </head>
  
<body>
<form id="downForm" action="<%=path%>/ExportServlet.do">
	<input type="hidden" name="btsName" id="btsName_ID" value="<%=strBtsName%>">
	<input type="hidden" name="tableNo"  value="19">
	<input type="hidden" name="registBeginTime" id="registBeginTimeIDForEX" value="<%=registBeginTime%>"/>
	<input type="hidden" name="registEndTime" id="registEndTimeIDForEX" value="<%=registEndTime%>"/>
</form>
<form id="backForm" method="POST" action="<%=path%>/pages/query/admin/query.jsp">
	<input type="hidden" name="choosedTableId" id="choosedTableId_ID" value="<%=strChoosedTableId %>"/>
	<input type="hidden" name="choosedBtsName" id="choosedBtsName_ID" value="<%=choosedBtsName%>"/>
	<input type="hidden" name="registBeginTime" id="registBeginTimeID" value="<%=registBeginTime%>"/>
	<input type="hidden" name="registEndTime" id="registEndTimeID" value="<%=registEndTime%>"/>
</form>
<div id="mainTabPanelDIV" style="width:100%;height:100%"/>
<script type='text/javascript'>
Ext.onReady(function(){  
	Ext.QuickTips.init();
	
	var viewport = new Ext.Viewport({
	    layout:'border',
	    frame:true,
	    items:[ 
	    	{
		        region: 'center',
		        contentEl: 'mainTabPanelDIV',
		        margins:'110 30 30 5',
		        split: true,
		        border: true	
		    }]
		});

	var recordType = Ext.data.Record.create([								
	          							   {name: 'id', type: "string"},
	          							   {name: 'btscode', type: "string"},
	          							   {name: 'btsname', type: "string"},
	          							   {name: 'btszone', type: "string"},
	          							   {name: 'landform', type: "string"},
	          							   {name: 'lng', type: "string"},
	          							   {name: 'lat', type: "string"},
	          							   {name: 'relocationrd', type: "string"},
	          							   {name: 'username', type: "string"},
	          							   {name: 'distcode', type: "string"},
	          							   {name: 'btslevel', type: "string"},
	          							   {name: 'workingradius', type: "string"},
	          							   {name: 'memo', type: "string"},
	          							   {name: 'graphDeatilAddr', type: "string"},
	          							   {name: 'graphHigh', type: "string"},
	          							   {name: 'trannetid', type: "string"},
	          							   {name: 'trannetname', type: "string"},
	          							   {name: 'trannetgrade', type: "string"},
	          							   {name: 'btskind', type: "string"},
	          							   {name: 'btstype', type: "string"},
	          							   {name: 'coverage', type: "string"},
	          							   {name: 'maintype', type: "string"},
	          							   {name: 'canEdit', type: "string"}, 
	          							   {name: 'refreshtime', type: 'date', dateFormat: 'Y/m/d'}
	          						 ]);

	   var cm  = new Ext.grid.ColumnModel(
	          			[
	          				{header: "基站编号", width:60,  sortable: true, dataIndex: 'btscode',align:'left'},
	          				{header: "基站名称", width:90,  sortable: true, dataIndex: 'btsname',align:'left'},
	          				{header: "位置区域", width:80,  sortable: true, dataIndex: 'btszone',align:'left'},	
	          				{header: "基站地形", width:70,  sortable: true, dataIndex: 'landform',align:'left'},	
	          				{header: "搬迁记录", width:80,  sortable: true, dataIndex: 'relocationrd',align:'left'},	
	          				{header: "维护人",  width:80,sortable: true, dataIndex: 'username',align:'left'},	
	          				{header: "所属地区", width:80, sortable: true, dataIndex: 'distcode',align:'left'},
	          				{header: "基站级别", width:70,  sortable: true, dataIndex: 'btslevel',align:'left'},
	          				{header: "有效工作半径",width:80,  sortable: true, dataIndex: 'workingradius',align:'left'},
	          				{header: "数据更新时间",width:80, sortable: true, renderer: Ext.util.Format.dateRenderer('Y-m-d'),dataIndex: 'refreshtime',align:'left'}		
	          			]
	          		);
	
   	var ds = new Ext.data.Store({
        proxy: new Ext.data.DWRProxy(JGeographicalenvWeb.getGeographicalenvByBtsName, true),	
        reader: new Ext.data.ListRangeReader({
            totalProperty: 'totalSize',
            id: 'id'
        }, recordType),
        sortInfo:{field:'id', direction:'ASC'}// 排序信息
    });
   	var gridDiv = Ext.get("mainTabPanelDIV");
	var grid = new Ext.grid.GridPanel({			
			el:'mainTabPanelDIV', 	
			ds: ds,
			cm: cm,  
			autoWidth : true,  
			autoScroll : true,  
			autoHeight　: false, 
			height: gridDiv.getComputedHeight(), 
			minSize: 200,		
			frame:true,
			collapsible:false, 
			enableDragDrop:false, 	
			tbar: new Ext.Toolbar(
					[
						{xtype:"tbfill"}, 
						{
				 			text:'返回',
				 			pressed:true,					 
				            handler:function()// 点击按钮执行的操作
				            {
								document.getElementById("backForm").submit();
				            }
				        },
				        '-',
				        {
				 			text:'导出',
				 			pressed:true,					 
				            handler:function()// 点击按钮执行的操作
				            {
				        	 document.getElementById("downForm").submit();
				            }
				        }
					]),	
			bbar: new Ext.PagingToolbar({
					pageSize: 17,
					store: ds,
					displayInfo: true,
					displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条',
					emptyMsg: "没有记录"
				})
		});	
	ds.on('beforeload', function() 
	{
		ds.baseParams = {'<%=Constant.BTS_NAME%>':'<%=strBtsName%>','registBeginTime':'<%=registBeginTime%>','registEndTime':'<%=registEndTime%>'};
	});
	ds.load({params:{start:0,limit:17,'<%=Constant.BTS_NAME%>':'<%=strBtsName%>','registBeginTime':'<%=registBeginTime%>','registEndTime':'<%=registEndTime%>'}});
	grid.render();		
		
})	
</script>  
</body>
</html>
